package com.ljy.controller.admin;

import com.ljy.dto.LeaseOrdersDTO;
import com.ljy.dto.LeaseOrdersPageDTO;
import com.ljy.dto.OrdersRefundDTO;
import com.ljy.entity.LeaseOrders;
import com.ljy.result.PageResult;
import com.ljy.result.Result;
import com.ljy.service.LeaseOrdersService;
import com.ljy.vo.LeaseOrdersVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController("adminLeaseOrdersController")
@RequestMapping("/admin/leaseOrder")
public class LeaseOrdersController {
    @Autowired
    LeaseOrdersService leaseOrdersService;
    @GetMapping("/page")
    public Result<PageResult<LeaseOrders>> page(LeaseOrdersPageDTO dto){
        PageResult<LeaseOrders> page = leaseOrdersService.page(dto);
        return Result.success(page);
    }
    @PutMapping("/{status}")
    public Result changeStatus(@PathVariable Short status,Integer orderId){
        leaseOrdersService.changeStatus(status,orderId);
        return Result.success();
    }
    @PostMapping("/cancel")
    public Result cancelOrRefund(@RequestBody OrdersRefundDTO dto){
        leaseOrdersService.cancelOrRefund(dto);
        return Result.success();
    }

}
